import React from 'react';
import {View} from 'react-native';
import styles from './index.style'
import MenuItem from "./MenuItem";


interface MenuProps {
    setShow: React.Dispatch<React.SetStateAction<boolean>>
    onMenuItemPress?: (item: string) => void
    menus: string[]
}

/**
 * Menu 组件
 * @author FlanChan
 * @param setShow
 * @param onMenuItemPress
 * @param menus
 * @constructor
 */
const Menu = ({setShow,onMenuItemPress,menus}: MenuProps) => {

    return (
        <View style={styles.menuContainer}>
            {menus.map(menu => (
                <MenuItem setShow={setShow} key={menu} item={menu} onPress={(menu) => {
                    onMenuItemPress && onMenuItemPress(menu)
                }}/>
            ))}
        </View>
    );
};

export default Menu;